package water.controller;

import app.nbdevices.modle.revModle.DataChangedModle;
import app.nbdevices.modle.revModle.ServiceModle;
import ele.dto.SumDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import water.dto.DataDto;
import water.entity.WaterCycleReport;
import water.modle.codecModle.WaterReport;
import water.modle.revModle.RevWaterReportData;
import water.service.IWaterService;
import water.utils.WaterDataDecode;
import water.utils.WaterExplain;

import java.util.List;

@Component
public class WaterController {

    @Autowired
    @Qualifier("WaterService")
    IWaterService svcWater;

    public void waterDataReport(DataChangedModle dataChanged){
        ServiceModle service = dataChanged.getService();
        RevWaterReportData revEleReportData=service.getData()
                .toJavaObject(RevWaterReportData.class);
        svcWater.saveWaterCycleData(revEleReportData,dataChanged.getDeviceId());
    }

    public List<DataDto> getWaterData(int t,String internetDevId){
        return svcWater.getWaterDataByTime(t,internetDevId);
    }

    public List<SumDto> getSumWater(){
        return svcWater.getWaterSum();
    }
}
